package org.sfx.rich

import java.lang.reflect.Field

case class FieldAccessor(underlying: Field, subject: Object) {
  def value: Object = underlying.get(subject)
  def value_=(newValue: Object): Unit = underlying.set(subject, newValue)
  def boolean: Boolean = underlying.getBoolean(subject)
  def boolean_=(newValue: Boolean): Unit = underlying.setBoolean(subject, newValue)
  def byte: Byte = underlying.getByte(subject)
  def byte_=(newValue: Byte): Unit = underlying.setByte(subject, newValue)
  def char: Char = underlying.getChar(subject)
  def char_=(newValue: Char): Unit = underlying.setChar(subject, newValue)
  def short: Short = underlying.getShort(subject)
  def short_=(newValue: Short): Unit = underlying.setShort(subject, newValue)
  def int: Int = underlying.getInt(subject)
  def int_=(newValue: Int): Unit = underlying.setInt(subject, newValue)
  def long: Long = underlying.getLong(subject)
  def long_=(newValue: Long): Unit = underlying.setLong(subject, newValue)
  def float: Float = underlying.getFloat(subject)
  def float_=(newValue: Float): Unit = underlying.setFloat(subject, newValue)
  def double: Double = underlying.getDouble(subject)
  def double_=(newValue: Double): Unit = underlying.setDouble(subject, newValue)
}
